package vip.ifmm.lehouse.common.model.empty;

import vip.ifmm.lehouse.common.enums.type.UserSexType;
import vip.ifmm.lehouse.common.model.User;

import java.util.Date;

/**
 * 具有默认值的用户类
 *
 * @author Fish
 * <p>Email: fishinlove@163.com</p>
 * <p>created by 2019/06/16 17:30:55</p>
 */
public class EmptyUser {

    // 内部类单例
    private static class Inner {

        // 内部初始化的类
        static User user = new User();

        static {
            user.setUserId(0);
            user.setUserNickname("");
            user.setUserEmail("");
            user.setUserPassword("");
            user.setUserHeadImage("");
            user.setUserSex(UserSexType.SECURE.getValue());

            final Date now = new Date();
            user.setUserBirthday(now);
            user.setUserCreateTime(now);
            user.setUserUpdateTime(now);
        }
    }

    // 返回一个具有默认值的用户对象
    public static User me() {
        return Inner.user;
    }
}
